<include file="Public:head" />
<div class="col-xs-12">
    <div class="tabbable">
        <ul class="nav nav-tabs padding-12 tab-color-blue background-blue" id="myTab">
            <li> <a href="{:U('Admin/Rule/admin_user_list')}">管理员列表</a> </li>
            <li class="active"> <a href="{:U('Admin/Rule/add_admin')}">添加管理员</a> </li>
        </ul>
        <div class="tab-content">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">登录账户：</label>
                    <div class="layui-input-inline">
                        <input name="username" lay-verify="required" value="{$user_data['username']}" placeholder="请输入登录账户" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号码：</label>
                    <div class="layui-input-inline">
                        <input name="phone" lay-verify="required" value="{$user_data['phone']}" placeholder="请输入手机号码" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">电子邮箱：</label>
                    <div class="layui-input-inline">
                        <input name="email" lay-verify="required" value="{$user_data['email']}" placeholder="请输入电子邮箱" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">初始密码：</label>
                    <div class="layui-input-inline">
                        <input name="password" lay-verify="required" placeholder="请输入初始密码" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">管理组：</label>
                    <div class="layui-input-inline">
                        <select name="group_ids[]" lay-filter="aihao" id="group_ids">
                            <foreach name="data" item="v">
                                <option value="{$v['id']}">{$v['title']}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item" id="status">
                    <label class="layui-form-label">账户状态：</label>
                    <div class="layui-input-block">
                        <input name="status" value="1" lay-filter="filter" title="正常" checked="checked" type="radio">
                        <input name="status" value="0" lay-filter="filter" title="禁用" type="radio">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                         <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                        <a href="{:U('admin_user_list')}" class="layui-btn layui-btn-normal" id="">返回</a>
                    </div>
                 </div>
            </form>
        </div>
    </div>
</div>
<script>
    layui.use(['upload','form','layedit'], function(){
        var form = layui.form;
        var layedit = layui.layedit; 
        form.verify({
            // money:[/^(([1-9]\d*)|\d)(\.\d{1,2})?$/,"请输入正确的价格！"],
        });      
        //监听提交
        form.on('submit(demo1)', function(data){
            $(data.form).ajaxSubmit({
                url:"{:U('add_admin')}",
                type: 'post',
                beforeSubmit:function(ormData,jqForm,options){
                    //加载层-风格4
                    layer.msg('加载中...', {
                      icon: 16,
                      shade: 0.2,
                      time:0,
                    });
                },
                success:function(responseText,statusText){
                    layer.closeAll();
                    if(responseText.status == 1){
                        layer.msg(responseText.info, {icon: 6,shade: 0.2,time:1000},function(){
                            location.href = responseText.url;
                        });
                    }else{
                        layer.msg(responseText.info, {icon: 5,shade: 0.2,time:1000});
                    }
                },
            });
            //layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
</script>
<include file="Public:foot" />